import { TimeStamp } from ".";

export interface Dictionary extends TimeStamp {
    _id: string;
    title: string;
    key: string;
    status: boolean;
    remark?: string;
    dictItems: DictionaryItem[] | string[];
}

export interface DictionaryItem {
    _id: string;
    label: string;
    value: string;
    backgroundColor?: string;
    status: boolean;
    sort: number;
    remark?: string;
}

export type CreateDictionaryReq = Omit<Dictionary, "_id"> & {
    dictItems?: Omit<DictionaryItem, "_id">[];
};

export type UpdateDictionaryReq = Partial<Dictionary> & {
    _id: string;
    dictItems?: Omit<DictionaryItem, "_id">[];
};

export type CreateDictionaryItemReq = Omit<DictionaryItem, "_id"> & { dictionaryId: string };

export type UpdateDictionaryItemReq = DictionaryItem;

export type AllDictionaryRecord = Pick<Dictionary, "key" | "title"> & {
    dictItems: Pick<DictionaryItem, "label" | "value" | "backgroundColor">[];
};
